package open.kiwipeach.autoconfigure.web.utils;

import cn.hutool.core.util.CharsetUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
import cn.hutool.crypto.symmetric.SymmetricCrypto;
import org.apache.shiro.crypto.hash.SimpleHash;

/**
 * 描述：认证授权相关工具类
 *
 * @author kiwipeach
 * @since 2.0
 */
public class OauthUtil {

    /**
     * 加密accessToken
     *
     * @param userName 用户名
     * @return 返回访问token
     */
    public static String encryptAccessToken(String userName) {
        return new SimpleHash("SHA1", userName, "nice-blog-sys", 1024).toString();
    }

    public static void main(String[] args) {
        String kiwipeach = encryptAccessToken("KiWiPeach");
        System.out.println(kiwipeach);
        //第一次：973f0d95c9e310ce92bfcf9889803bf5752a7760
        //第二次：973f0d95c9e310ce92bfcf9889803bf5752a7760
    }

}